package lion.framework.core.task.anno;

import java.lang.annotation.Annotation;

import lion.dev.lang.MapJ;
import lion.framework.core.anno.AnnotationProcessorManager;
import lion.framework.core.anno.IAnnotationProcessor;
import lion.framework.core.task.AutoTaskManager;
import lion.framework.core.task.IAutoTask;

/**
 * 自动任务处理类
 *
 * @author lion
 * @email hl_0074@sina.com
 * @date 2015年3月18日
 */
// @AnnoProcessor(AutoTask.class)
public class AutoTaskAnnoProcessor implements IAnnotationProcessor {

	@SuppressWarnings("unchecked")
	@Override
	public void processe(MapJ ctx, Annotation anno) throws Exception {

		Class<?> clazz = ctx.getE(AnnotationProcessorManager.ANNO_CONTEXT_TARGET);
		if (!IAutoTask.class.isAssignableFrom(clazz)) { return; }

		AutoTaskManager.registAutoTaskType((Class<? extends IAutoTask>) clazz);
	}
}
